/**
 * Copyright (c) 2020-2021 浦东大爷 All rights reserved.
 * 机会永远都是留给有准备的人
 */
package com.learning.moudle3;

import java.math.BigInteger;

/**
 * @author: gitwo
 * @date: 2020-11-22
 * @description:
 */
public class MathTest {

    /**
     * 斐波那契数列数列的通项公式做法，N要小于47
     * @param args
     */
    public static void main(String[] args) {
        int n = 46;
        int an2 = (int)((1.0/Math.sqrt(5)) * (Math.pow((1+Math.sqrt(5))/2, n) - Math.pow((1-Math.sqrt(5))/2, n)));

        System.out.println(an2);
    }
}
